<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = `<span>9.7<span><span>-248人评价</span><br>
        <span>9.5<span><span>-48人评价</span>
        <br><span>9.6<span><span>-508人评价</span>`;
        /* 
        arr = [
            {star:9.7,rating:248},
            {star:9.5,rating:48},
            {star:9.6,rating:508},
        ]
         */
        var list = str.split("<br>")
        
        var res = list.map(item=>{
            
            return item.replace(/<[^<>]+>/g,"").trim().split("-")
            
        })
        console.log(res);
        var arr = [];
        res.forEach(item=>{
            console.log(item)
            arr.push({
                star:item[0],
                rating:item[1].replace(/[^\d]/g,"")
            })
        })
        console.log(arr)
    </script>
</body>
</html>